<template>
  <div class="wrap">
    <template v-if="orderInfo">
      <div class="c-flex-column c-flex-center c-mt80">
        <i class="iconfont c-fs52 c-fc-45B930">&#xe796;</i>
        <span class="c-fs28 c-fc-45B930 c-fw-b c-mt20">{{prodType == ckFrom.camp && spId ? '订单提交' : '支付'}}成功</span>
      </div>
      <div class="c-fs24 c-fc-sblack c-textAlign-c c-mt70" v-if="prodType == ckFrom.camp && spId">使用“ <span class="c-fc-45B930">先学后付(0元下单)</span> ”，环节完成后将自动支付费用</div>
      <!-- 支付内容 -->
      <div v-else class="c-flex-column c-flex-center c-mt70">
        <p class="c-fs40 c-fc-xblack c-fw-b c-lh">
          <span>{{'￥' | iosPriceFilter}}</span>
          <span class="c-fs64 c-lh">{{!payInfo ? orderInfo.payMoney : orderInfo.price}}</span>
        </p>
        <p v-if="isShowPoint" class="c-fs24 c-fc-sorange c-mt10">获得{{!payInfo ? orderInfo.addPoint : orderInfo.givenPoints}}{{customPointName}}</p>
      </div>
      <!-- 查看课程 -->
      <div class="c-flex-row c-aligni-center c-justify-center c-mt60 coms-live-iframe-none">
        <div class="c-flex-row c-aligni-center c-justify-center c-br40 c-fs26 theme-bg c-fc-white c-hh64" :class="(isShowMoreDevice || (prodType == ckFrom.camp && spId)) ? 'c-ww240 ' : 'c-ww300'" @click="handleClickDetail()">{{prodType == ckFrom.valuableCoupon ? '查看优惠券' : prodType == ckFrom.shopping || prodType == ckFrom.collocationBuy ? '查看订单':'查看课程'}}</div>
        <more-device btnClass="c-br40 c-fs26 theme-bd1 theme-fc c-hh64 c-ww240 c-ml30 c-boxSizing-b" :fromPage="2" :personalRoomIsLiving="liveStatus == 1 ? true : false" :prodInfo="{prodType: orderInfo.prodInfo.prodType, prodId: orderInfo.prodInfo.prodId, courseType: orderInfo.prodInfo.courseType, liveType: orderInfo.prodInfo.prodType == 51 ? liveType : orderInfo.prodInfo.prodType == 180 ? 6 : -1 }" @openInH5="handleClickDetail()" v-if="isShowMoreDevice"></more-device>
        <!-- 微信支付分才展示（暂时没用，后续有用的话需考虑三个按钮怎么放） -->
        <div v-if="prodType == ckFrom.camp && spId" class="c-flex-row c-flex-center c-br40 c-fs26 theme-bd1 theme-fc c-hh64 c-ww240 c-ml30 c-boxSizing-b" @click="goOrderDetail">查看订单</div>
      </div>
      <div v-if="hasGiftRelates" class="c-fs24 c-fc-xblack c-mt30 c-textAlign-c">前往<span class="theme-fc c-ml8" @click="goOrderDetail">我的订单</span>，查看详情</div>
      <!-- 领取证书 -->
      <div v-if="showStudyCard" class="c-mt30 c-ph24 c-pv20" @click="handleClickCertificate()">
        <div class="badge-bg c-flex-row c-aligni-center c-justify-sb c-ph20 c-pv20">
          <div class="c-ww36 c-hh40">
            <img :src="require('@/assets/i/wap/camp/medal.png')" class="c-w100 c-h c-object-fit-c" alt="">
          </div>
          <div class="c-w0 c-flex-column c-flex-grow1 c-justify-sb c-ph10">
            <div class="c-fc-A2743D c-fs28 c-fw600 c-text-ellipsis1">恭喜您获得入学证书</div>
          </div>
          <div class="c-fs22 c-fc-A2743D c-flex-row c-flex-center">
            查看
            <i class="iconfont c-pl10">&#xe635;</i>
          </div>
        </div>
      </div>
      <!-- 二维码 -->
      <div class="c-flex-column c-justify-center c-aligni-center c-mt50" v-if="orderInfo.guideData && orderInfo.guideData.isOpenGuide == 1 && ((orderInfo.guideData.guideType.includes(2)) || (orderInfo.guideData.guideType.includes(1) && prodType == ckFrom.shopping))">
        <p class="c-fs24 c-fc-xblack c-ph30 c-textAlign-c c-mt20" v-if="orderInfo.guideData.guideDesc != ''">{{orderInfo.guideData.guideDesc}}</p>
        <div class="c-ww240 c-hh240 c-br c-mt50 c-p c-pz1 c-br8">
          <div class="iconfont c-fs32 theme-fc c-pa c-p-tm8 c-p-lm8 c-pz10 c-rotate180">&#xe865;</div>
          <div class="iconfont c-fs32 theme-fc c-pa c-p-tm8 c-p-rm8 c-pz10 c-rotate270">&#xe865;</div>
          <div class="iconfont c-fs32 theme-fc c-pa c-p-bm8 c-p-lm8 c-pz10 c-rotate90">&#xe865;</div>
          <div class="iconfont c-fs32 theme-fc c-pa c-p-bm8 c-p-rm8 c-pz10">&#xe865;</div>
          <img class="c-w100 c-h c-p c-pz1 c-br8" :src="$addXossFilter(orderInfo.guideData.guideQrcode)" alt="">
        </div>
        <p class="c-fs28 c-lh24 c-fc-xblack c-fw600 c-mt50" v-if="orderInfo.guideData.guideTitle != ''">{{orderInfo.guideData.guideTitle}}</p>
        <p class="c-fs24 c-lh24 c-fc-sblack c-fw400 c-mt20">长按二维码识别或保存截图，即可进群交流</p>
      </div>
      <!-- 支付有礼图片 -->
      <div class="c-flex-row c-aligni-center c-justify-center c-mt70 c-pb80 c-mh24" v-if="payAward && payAward.palId">
        <div class="c-w100 c-hh136" @click="handleClickpayAward()">
          <!-- awardType:1优惠卷2商城3参与活动 -->
          <template v-if="payAward.awardType == 1">
            <img
              src="https://kposshzcdn.ckjr001.com/admin/material/9_material_admin/image/assets/i/wap/payPolitely/coupon.png"
              alt=""
            >
          </template>
          <template v-else-if="payAward.awardType == 2">
            <img
              src="https://kposshzcdn.ckjr001.com/admin/material/9_material_admin/image/assets/i/wap/payPolitely/gift.png"
              alt=""
            >
          </template>
          <template v-else>
            <img
              src="https://kposshzcdn.ckjr001.com/admin/material/9_material_admin/image/assets/i/wap/payPolitely/activity.png"
              alt=""
            >
          </template>
        </div>
      </div>
      <!-- 优惠卷 -->
      <coupon-modal v-if="showCouponDialog" :adName="adName" :isVoucher="isVoucher" :adCoupon="adCoupon" :isPayAward="isPayAward" :palId="palId" :osId="palId" recordType="-1" :showCouponDialog.sync="showCouponDialog"></coupon-modal>
      <!-- 赠品为知识商品弹窗 -->
      <div class="c-w100 c-h c-pf c-p-t0 c-p-l0 c-p-b0 c-p-r0 c-translucent-balck50 c-pz6" v-show="giftModal" v-if="awardInfo" @click.stop="handleClickCloseModal()">
        <div class="giftDialog c-flex-row c-justify-center">
          <div class="c-fs40 c-fc-reword c-pa c-text-ellipsis1 c-fw600 giftDialog_msg">{{awardInfo.prodType == ckFrom.course ? '恭喜您获得学习权限':'恭喜您获得下方的商品'}}</div>
          <div class="c-pa c-ww240 c-hh160 giftDialog_img">
            <img class="c-m-0auto imgCloseBig c-maxh c-h c-object-fit-c" :src="$addXossFilter(awardInfo.cover)" alt="">
          </div>
          <div class="c-pa c-text-ellipsis1 c-fs24 c-fc-xblack giftDialog_name">{{awardInfo.name}}</div>
          <div class="c-pa giftDialog_btn c-flex-row c-flex-center" @click.stop="handleClickSubmit()">{{awardInfo.prodType == ckFrom.course ? '查看':'立即领取'}}</div>
          <div class="giftDialog_get c-pa c-fs22 c-text-ellipsis1" v-if="awardInfo.prodType == ckFrom.course">您可前往"我的课程"进行查看并学习</div>
        </div>
      </div>
    </template>
    <!-- 推荐有礼 -->
    <recommend-present ref="recommendPresent" from="payPolitely" @setSuccessRecommendFlag="setSuccessRecommendFlag" @beforeChangeRoute="beforeChangeRoute" @goOrderDetail="goOrderDetail"></recommend-present>
    <!-- 入学证书 -->
    <enrol-cer :isReceivedStudy="isReceivedBuy" ref="enrolcerCom" :bigType="2"></enrol-cer>
  </div>
</template>

<script>
import { utilJs } from "@/utils/common.js";
import couponModal from "@/components/templates/couponModal.vue";
import recommendPresent from '@/components/templates/recommendPresent';
import { getUrlDetail } from "@/utils/goDetails.js";
import enrolCer from "@/components/templates/learnAndachCer/enrolCer.vue";
import MoreDevice from "@/components/templates/moreDevice.vue"
let getSignPlanOrderTimes = 0;
export default {
  name: "PayPolitely",
  data() {
    return {
      orderId: '',
      orderInfo: null,
      prodType: '', //模板类型
      payAward: null, //支付有礼信息
      showCouponDialog: false,
      adCoupon: [],
      freeShipping: 0,
      payAwardData: {},
      palId: '',
      giftModal: false,
      ckFrom: global.ckFrom,
      awardInfo: null,
      isPayAward: false, //判断当前为支付有礼的优惠卷
      isVoucher: false,
      adName: '恭喜你获得优惠券礼包',
      hasGiftRelates: false,
      payInfo: 0, // 商城购买赠送积分标识
      showStudyCard:false,
      postProdType:'',
      spId: '',
      goodsToGet: false, //礼包中含有商城商品
      customPointName: localStorage.getItem("customPointName"),
      cfg: JSON.parse(localStorage.getItem("cfg")),
      isCollage: false,
      liveStatus: 1,
      liveType: -1,
      isWeChat: utilJs.isWeiXin(),
      tags: null, // tags 2=拼团 4096=砍价
    }
  },
  components: {
    couponModal,
    recommendPresent,
    enrolCer,
    MoreDevice
  },
  computed: {
    isShowMoreDevice() {
      return this.orderInfo && this.orderInfo.prodInfo && !this.isCollage
    },
    isShowPoint() {
      return (this.orderInfo.addPoint && this.orderInfo.addPoint != 0) || (this.payInfo && this.orderInfo.givenPoints)
    }
  },
  mounted() {
    getSignPlanOrderTimes = 0;
    this.orderId = this.$route.query.orderId;
    this.prodType = this.$route.query.prodType;
    this.spId = this.$route.query.spId || '';
    this.isCollage = this.$route.query.isCollage ? true : false;
    this.giftModal = false;
    this.goodsToGet = false;
    this.showCouponDialog = false;
    this.adName = '恭喜你获得优惠券礼包';
    // 推荐有礼
    this.recType = this.$route.query.recType || '';
    this.recRelateId = this.$route.query.recRelateId || '';
    this.successRecommendFlag = this.$route.query.successRecommendFlag || 1;
    this.isGroupPurchase = Number(this.$route.query.isGroupPurchase) || 0;
    this.cId = this.$route.query.cId || '';
    this.extId = this.$route.query.extId || '';
    this.payInfo = this.$route.query.payInfo || '';
    this.liveStatus = 1;
    this.liveType = -1;
    setDocumentTitle("支付成功");
    if (this.prodType == this.ckFrom.valuableCoupon || this.prodType == this.ckFrom.collocationBuy) {
      this.orderInfo = {
        payMoney: this.$route.query.payMoney || '',
        guideData: ''
      }
    } else if (this.prodType == this.ckFrom.shopping) {
      this.getGuideGoodsOrderInfo();
    } else if (this.prodType == this.ckFrom.camp && this.spId) {
      setTimeout(() => { //延迟等待后台生成orderId，否则可能取不到
        this.getSignPlanOrder();
      }, 600);
    } else {
      this.getGuideOrderInfo();
      this.finishRecommendTask();
      this.getUserGiftRelates();
    }
    this.wechatShare();
  },
  beforeDestroy() {
    this.$cjConfirm.hide();
  },
  methods: {
    goOrderDetail() {
      this.$routerGo(this, "push", {
        path: '/member/myOrder/knowledgeOrderDetail',
        query: {
          orderId: this.orderId
        }
      })
    },
    getUserGiftRelates() {
      utilJs.getMethod(global.apiurl + 'orders/getUserGiftRelates?orderId=' + this.orderId, res => {
        if (res && res.length > 0) {
          let $this = this;
          this.hasGiftRelates = true;
          res.forEach((item) => {
            if (item.prodType == global.ckFrom.shopping && item.status != 1) {
              this.goodsToGet = true;
              this.$cjConfirm({
              title: '', //
              titleCenter: true, //标题是否居中
              message: '赠品礼包中包含商城商品，是否前往兑换',
              messageCenter: true, //内容是否居中
              showMasker: true, //是否显示透明背景
              clickCloseModal: false, //是否点击透明背景关闭弹窗
              showCancelButton: true, //是否显示取消按钮
              cancelButtonText: '取消', //取消按钮文本
              confirmButtonText: '去兑换', //确认按钮文本
              onConfirm() {
                $this.$routerGo($this, "push", {
                  path: '/member/myOrder/knowledgeOrderDetail',
                  query: {
                    orderId: $this.orderId,
                    exchangeGoods: 1
                  }
                })
              }
            })
            }
          })
        } else {
          this.hasGiftRelates = false;
        }
      }, failRes => {
        this.hasGiftRelates = false;
      });
    },
    beforeChangeRoute() {
      if (this.prodType == global.ckFrom.course || this.prodType == global.ckFrom.column || this.prodType == global.ckFrom.package) {
        //课程，专栏，知识套餐，存在买赠积分的话，缓存积分
        let pointId = this.prodType == global.ckFrom.course ? this.cId : this.extId;
        sessionStorage.setItem(pointId + 'rewardPoints', this.rewardPoints);
      }
    },
    setSuccessRecommendFlag(flag) {
      this.successRecommendFlag = flag;
    },
    finishRecommendTask() {
      if (this.recType == 3 && this.recRelateId && this.successRecommendFlag == 0 && !this.isGroupPurchase) {
        let data = { relateId: this.recRelateId, orderId: this.orderId };
        this.$nextTick(() => {
          this.$refs.recommendPresent.completetRecommendTask(data); // 调用子组件方法
        })
      }
    },
    handleClickCloseModal() {
      this.giftModal = false;
    },
    handleClickSubmit() {
      if (this.awardInfo.prodType == this.ckFrom.course) {
        this.$routerGo(this, "replace", { path: "/member/myInterest/interestIndex" });
      } else {
        this.getShopInfo(this.awardInfo.prodId, this.palId)
      }
    },
    // 点击判断选择支付有礼奖品类型
    handleClickpayAward() {
        this.awardInfo = this.payAward.awardInfo;
        this.palId = this.payAward.palId;
        if (this.payAward.awardType == 1) {
          this.isPayAward = true;
          this.adCoupon = this.payAward.redeemDataList;
          this.isVoucher = this.payAward.redeemDataList.some(item => {
            if (item.couponSource == 2) {
              return true;
            }
          })
          this.adCoupon.forEach(ele => {
            ele.startAt = ele.startAt ? ele.startAt.split(' ')[0].replace(/-/g, '.') : ''
            ele.endAt = ele.endAt ? ele.endAt.split(' ')[0].replace(/-/g, '.') : ''
          })
          if (this.adCoupon.length == 0) {
            this.adName = '啊哦,赠品已经领完了~'
          }
          console.log(this.adCoupon)
          this.showCouponDialog = true;
          return;
        }
        if (this.payAward.awardType == 2) {
          this.giftModal = true;
        } else {
          // 活动
          let goPath = this.payAward.awardInfo.url.match(/#(\S*)/)[1];
          this.$routerGo(this, "push", {
            path: goPath
          });
        }
    },
    handleClickCertificate() {
      this.$refs.enrolcerCom.drawNow('', this.orderInfo.prodId, this.postProdType)
    },
    judgeCompliance() {
      console.log(this.prodType, this.orderInfo.prodInfo.courseType)
      this.postProdType = this.prodType == 5 ? (this.orderInfo.prodInfo.courseType == 0 ? global.ckFrom.video :
      this.orderInfo.prodInfo.courseType == 1 ? this.orderInfo.prodInfo.voice :
      global.ckFrom.imgText) : this.prodType
      let postUrl = `${global.apiurl}Certificate/judgeCompliance?prodType=${this.postProdType}&prodId=${this.orderInfo.prodId}`;
      // enableStudyCard	number
      // 是否有设置学习证书1=是；0=否
      // isReceivedStudy	number
      // 是否已经领取了证书：1=是；0=否
      // isComplianceStudy	number
      // 是否达到学习证书发放条件：1=是；0否
      // studyHonorImage	string
      // 学习证书图片（如果领取了会有图片）
      // enableBuyCard	number
      // 是否有设置入学证书1=是；0=否
      // isReceivedBuy	number
      // 是否已经领取了入学证书：1=是；0=否
      // isComplianceBuy	number
      // 是否达到入学证书发放条件：1=是；0否
      // buyHonorImage	string
      // 入学证书证书图片（如果领取了会有图片）
      utilJs.getMethod(postUrl, res => {
        if (res.enableBuyCard == 1 && res.isComplianceBuy == 1) {
          this.showStudyCard = true
          this.isReceivedBuy = res.isReceivedBuy
          // this.$resf.learnCer.drawNow('', this.courseId, global.ckFrom.imgText,res.isReceivedStudy)
        }
      });
    },
    //跳转表单 prodId--产品id, ckFrom-类型, relType--prodType吧, type--表单的类型
    goForm() {

      const {relId, relType, type, ckFrom, courseType } = this.orderInfo.forms
      let pathQuery = {
        extId: relId,
        relId: relId,
        cId: relId,
        ckFrom: ckFrom,
        isFromInvite: 0,
        relType: relType,
        type: type,
        courseId: relId,
        courseType:courseType,
        isBuied: 1,
        isGoBack: 1, //从购买后跳过去的都有权限
      };
      console.log(ckFrom)
      if (ckFrom == 78) {
        pathQuery.ttId = relId;
      }
      console.log('参数', pathQuery)
      this.$routerGo(this, "push", { path: '/homePage/form', query: pathQuery });
    },
    // 查看课程
    handleClickDetail() {
      if (this.prodType == this.ckFrom.valuableCoupon) {
        this.$routerGo(this, "replace", { path: "/member/myValueVoucher/myValueVoucher", query: { couponType: 6 } });
      } else if (this.prodType == this.ckFrom.collocationBuy) {
        this.$routerGo(this, "replace", {
          path: '/member/myOrder/knowledgeOrderDetail',
          query: {
            orderId: this.orderId,
            tabIndex: -1
          }
        })
      } else if (this.prodType == this.ckFrom.shopping) {
        if (this.payInfo == 1 ) {
          this.$routerGo(this, "replace", { path: '/mall/mallOrder/orderDetail', query: {goId: this.orderInfo.goId} })
        } else {
          this.$routerGo(this, "replace", { path: "/member/myOrder/allOrderList" });
        }
      } else if (this.prodType == this.ckFrom.collageEdu) {
        this.$routerGo(this, "replace", {
          path: "/edu/eduDetail",
          query: {
            id: this.orderInfo.prodId
          }
        });
      } else {
        if (this.$route.query.isSubMch) { //isSubMch： 1是服务商二级商户， 0普通商户；二级商户的话跳转到点金计划页面，所以返回页面后要替换成来时的页面
          let query = {};
          if (this.orderInfo.prodInfo.prodType == 68 || this.orderInfo.prodInfo.prodType == 69) { //vip拼团
            query.isSales = true;
          }
          let rurl = getUrlDetail(this.orderInfo.prodInfo.prodType, this.orderInfo.prodInfo.prodId, query, this.orderInfo.prodInfo.courseType);
          this.$routerGo(this, "replace", { path: rurl })
        } else if (this.$route.query.rePlaceDetailUrl && Number(this.$route.query.rePlaceDetailUrl) == 1) {
          let rurl = getUrlDetail(this.orderInfo.prodInfo.prodType, this.orderInfo.prodInfo.prodId, null, this.orderInfo.prodInfo.courseType);
          this.$routerGo(this, "replace", { path: rurl });
        } else if (this.prodType == this.ckFrom.camp && this.spId) {
          let rurl = getUrlDetail(this.orderInfo.prodInfo.prodType, this.orderInfo.prodInfo.prodId);
          this.$routerGo(this, "replace", { path: rurl });
        } else {
          //tags 2=拼团 4096=砍价
          if (this.tags == 2) {
            // console.log('是走这里返回上一页')
            // this.$router.go(-1);
            // // 如果是拼团--特殊流程--跳转到拼团详情页
            console.log('拼团', this.orderInfo)
            const pathQuery = {
              groupId: this.orderInfo.groupId || -1,
              collageId: this.orderInfo.collageId,
              extId: this.orderInfo.prodId,
              relType:  this.orderInfo.forms ? this.orderInfo.forms.relType : null,
              isRelForm:this.orderInfo.forms ? !this.orderInfo.hasFormLog : ''
            }
            console.log('pathQuery', pathQuery)
            this.$routerGo(this, "push", {
              path: "/homePage/collage/collageDetail",
              query: pathQuery
            });
          } else if (this.orderInfo.forms && this.orderInfo.forms.relId && !this.orderInfo.hasFormLog) {
            console.log('1111')
            // 如果是购买后填写表单的跳转表单页面
            this.goForm()
          } else {
            console.log(22222)
            if (this.tags == 4096) {
              let rurl = getUrlDetail(this.orderInfo.prodInfo.prodType, this.orderInfo.prodInfo.prodId, null, this.orderInfo.prodInfo.courseType);
              this.$routerGo(this, "replace", { path: rurl });
            } else {
              this.$router.go(-1);
            }
          }
        }
      }
    },
    // 获取商城入群引导信息
    getGuideGoodsOrderInfo() {
      let _this = this;
      utilJs.getMethod(global.apiurl + 'common/getGuideGoodsOrderInfo?goId=' + this.orderId, function (res) {
        _this.orderInfo = res;
        _this.payAward = res.hadPayAward
        if (_this.payAward && _this.payAward.palId) {
          _this.handleClickpayAward();
        }
        if (_this.payInfo == 1 && sessionStorage.getItem('payInfo')) {
          let payInfo = JSON.parse(sessionStorage.getItem('payInfo')) ? JSON.parse(sessionStorage.getItem('payInfo')) : null;
          _this.orderInfo = Object.assign(_this.orderInfo, payInfo)
          sessionStorage.removeItem('payInfo');
        }
      },
        failRes => {
        }
      );
    },
    getSignPlanOrder() {
      utilJs.postMethod(global.apiurl + 'payScorePlan/getSignPlanOrder', {sign_plan_id: this.spId}, res => {
        if (res.orderId) {
          this.orderId = res.orderId
          this.getGuideOrderInfo();
          this.finishRecommendTask();
          this.getUserGiftRelates();
        } else {
          if (getSignPlanOrderTimes < 4) { //可能请求不到orderId，重复请求
            setTimeout(() => {
              this.getSignPlanOrder();
              getSignPlanOrderTimes++
            }, 400);
          } else {
            this.orderInfo = {
              payMoney: '',
              guideData: '',
              prodInfo: {
                prodType: this.ckFrom.camp,
                prodId: this.$route.query.prodId || ''
              }
            }
          }
        }
      },
        failRes => {
        }
      );
    },
    // 获取入群引导，支付有礼信息
    getGuideOrderInfo() {
      let _this = this;
      utilJs.getMethod(global.apiurl + 'common/getGuideOrderInfo?orderId=' + this.orderId + '&prodType=' + this.prodType, function (res) {
        _this.orderInfo = res;
        _this.payAward = _this.orderInfo.hadPayAward || null;
        _this.tags = res.tags || null;
        _this.judgeCompliance()
        // 若是送优惠卷的直接弹窗
        if (_this.payAward && _this.payAward.palId) {
          _this.handleClickpayAward();
        }
        if (_this.prodType == _this.ckFrom.camp && _this.spId) {
          _this.orderInfo.payMoney = '';
          _this.orderInfo.guideData = '';
          if (_this.orderInfo.prodInfo) {
            _this.orderInfo.prodType = _this.ckFrom.camp;
            _this.orderInfo.prodId = _this.$route.query.prodId || ''
          } else {
            _this.orderInfo.prodInfo = {
              prodType: _this.ckFrom.camp,
              prodId: _this.$route.query.prodId || ''
            }
          }
        }
        if (_this.orderInfo.prodInfo && _this.orderInfo.prodInfo.prodType == _this.ckFrom.personalLive) {
          _this.getLiveInfo();
        }
        if (_this.orderInfo.prodInfo && _this.orderInfo.prodInfo.prodType == _this.ckFrom.live) {
          _this.getLiveDetail();
        }
      },
        failRes => {
        }
      );
    },
    getLiveInfo() {
      let url = `${global.apiurl}live/livePersonal/show/${this.orderInfo.prodInfo.prodId}?refereeId=${localStorage.getItem("refereeId")}&isSkeleton=1&time=${new Date().getTime()}`
      utilJs.getMethod(url, (res) => {
        this.liveStatus = res.data[0].liveStatus;
      });
    },
    //获取直播信息
    getLiveDetail() {
      let postUrl = global.apiurl + "liveFlow/getMobileLiveActivityById/" + this.orderInfo.prodInfo.prodId + '?isSkeleton=1&time=' + new Date().getTime();
      utilJs.getMethod(postUrl,
        res => {
          this.liveType = res.data[0].liveType;
        }, () => {
      });
    },
    getShopInfo(prodId, palId) {
      utilJs.getMethod(
        global.apiurl + "goods/goodsDetail?mgId=" + prodId + "&palId=" + palId,
        res => {
          this.shopInfo = res.goods;
          this.freeShipping = res.freeShipping;
          this.payAwardData = res.payAwardData;
          let shopInfo = [
            {
              mgId: this.shopInfo.mgId,
              mcId: "",
              avatar: this.shopInfo.avatar ? this.shopInfo.avatar : "",
              pointsDeduct: 0,
              name: this.shopInfo.name,
              price: this.payAwardData.price,
              originalPrice: this.shopInfo.originalPrice,
              quantity: 1,
              shopSpecInfo: "",
              gsiiId: "",
              postage: this.shopInfo.postage,
              isMail: this.shopInfo.isMail,
              isMallExpressDeliver: this.shopInfo.isMallExpressDeliver,
              isMallOfflineDeliver: this.shopInfo.isMallOfflineDeliver,
              stock: 1,
              salesStock: "",
              collageStock: "",
              freeShipping: this.freeShipping,
              isFlashSales: false,
              isCollage: false,
              pId: "",
              noLimit: false,
              vipDiscount: this.shopInfo.vipDiscount,
              svipDiscount: this.shopInfo.svipDiscount,
              agentDiscount: this.shopInfo.agentDiscount,
              partnerDiscount: this.shopInfo.partnerDiscount,
              branchDiscount: this.shopInfo.branchDiscount,
              isPayAward: true,
              limitType: -1,
              limitNumber: 0,
              purchasedNum: 0,
              vipDiscountType: this.shopInfo.vipDiscountType || 1
            }
          ];
          if (this.shopInfo.valuationMethod && this.shopInfo.valuationMethod == 2 && this.shopInfo.freightMode == 1) {
            shopInfo.valuationMethod = this.shopInfo.valuationMethod;
          }
          sessionStorage.setItem("shopBuyInfo", JSON.stringify(shopInfo));
          let goPath = "/mall/shopSettlement/shopSettlement?shopNo=" + prodId + "&palId=" + palId;
          this.$routerGo(this, "push", {
            path: goPath
          });
        }
      );
    },
    wechatShare: function () {
      let title = '支付成功';
      let shareImg = window.localStorage.getItem("shareLogo");
      let shareUrl = `${window.location.href.split("#")[0]}#${this.$route.path}?refereeId=${localStorage.getItem("userId")}&orderId=${this.orderId}`;
      let shareDesc = '点击查看详情';
      utilJs.wechatConfig(shareUrl, title, shareImg, shareDesc);
    },
    //手机端分享
    appShare: function () {
      let title = '支付成功';
      let shareImg = window.localStorage.getItem("shareLogo");
      let shareUrl = `${window.location.href.split("#")[0]}#${this.$route.path}?refereeId=${localStorage.getItem("userId")}&orderId=${this.orderId}`;
      let shareDesc = '点击查看详情';
      utilJs.appShareTrue(title, shareImg, shareUrl, shareDesc);
    },
  }
}
</script>

<style lang="less" scoped>
.family-card-bg {
  background: url("../../../assets/i/wap/vip/familyCard.png");
  background-size: cover;
  padding-left: 3.45rem;
  padding-right: 0.35rem;
}
.equity-vip-bg {
  background: url("../../../assets/i/wap/recommend/VIP.png");
  background-size: cover;
  padding-left: 3.45rem;
  padding-right: 0.35rem;
}
.equity-svip-bg {
  background: url("../../../assets/i/wap/recommend/SVIP.png");
  background-size: cover;
  padding-left: 3.45rem;
  padding-right: 0.35rem;
}
.dia-head-bg {
  padding-top: 5rem;
}
.dialog-mid {
  background: url("../../../assets/i/wap/recommend/recommend-present-mid.png")
    no-repeat;
  background-size: 100% 100%;
  padding-right: 0.4rem;
}
.coupon-mb1 {
  background: url("../../../../public/i/wap/vip/coupon-mb1.png");
  background-size: cover;
}
.exchange-left1 {
  background: url("../../../../public/i/wap/coupon/exchange.png") no-repeat 100%;
  background-size: 100% 100%;
}
.c-mb60 {
  margin-bottom: 1.5rem;
}
.c-mt70 {
  margin-top: 1.75rem;
}
.bd1-b1-f6 {
  border-bottom: 1px solid #f6f6f6;
}
.giftDialog {
  position: relative;
  top: 50%;
  left: 50%;
  width: 15.9rem;
  height: 19.475rem;
  margin-top: -9.7375rem;
  transform: translateX(-50%);
  background: url("https://kposshzcdn.ckjr001.com/admin/material/9_material_admin/image/assets/i/wap/payPolitely/giftDialog_bg.png") no-repeat center center;
  background-size: contain;
  .giftDialog_msg {
    top: 3.65rem;
    left: 50%;
    transform: translateX(-50%);
  }
  .giftDialog_img {
    top: 6.25rem;
    left: 50%;
    transform: translateX(-50%);
    overflow: hidden;
  }
  .giftDialog_name {
    top: 10.75rem;
    left: 50%;
    transform: translateX(-50%);
  }
  .giftDialog_btn {
    width: 10.5rem;
    height: 1.9rem;
    top: 14.1rem;
    left: 50%;
    transform: translateX(-50%);
    background: url("../../../assets/i/wap/payPolitely/giftDialog_btn.png") no-repeat center center;
    background-size: contain;
    color: #F95F40;
    font-size: .7rem;
  }
  .giftDialog_get {
    bottom: 2.2rem;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
  }
}
.badge-bg {
  width: 100%;
  height: 2.9rem;
  background: url('../../../assets/i/wap/camp/badge-bg.png') no-repeat center center;
  background-size: contain;
}
.bg-deepGreen {
  background-color: #23DB85;
}
</style>